package com.whmskj.xjlhsc.mobie.personnelFile.mapper;

import com.whmskj.xjlhsc.mobie.personnelFile.entity.ApprovalRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 审批记录Mapper
 * @author System
 * @date 2025-01-15
 */
@Mapper
public interface ApprovalRecordMapper {
    
    /**
     * 插入审批记录
     */
    int insert(ApprovalRecord record);
    
    /**
     * 根据申请ID查询审批记录列表
     */
    List<Map<String, Object>> selectByApplicationId(@Param("applicationId") Integer applicationId);
    
    /**
     * 根据申请ID和审批节点查询审批记录
     */
    ApprovalRecord selectByApplicationIdAndNode(@Param("applicationId") Integer applicationId, 
                                               @Param("approvalNode") String approvalNode);
    
    /**
     * 检查申请是否已通过指定节点的审批
     */
    boolean isNodeApproved(@Param("applicationId") Integer applicationId, 
                          @Param("approvalNode") String approvalNode);
    
    /**
     * 获取申请的所有已审批节点
     */
    List<String> getApprovedNodes(@Param("applicationId") Integer applicationId);
}
